package cn.zzz.openplatform.common.selector;

import cn.zzz.openplatform.common.model.OpenApiCredentials;

import java.security.SecureRandom;
import java.util.List;
import java.util.Random;

/**
 * 随机策略实现
 */
public class RandomSelector implements CredentialSelector {
    private final Random random = new SecureRandom();

    @Override
    public <T extends OpenApiCredentials> T select(List<T> credentials) {
        return credentials.get(random.nextInt(credentials.size()));
    }
}